<!DOCTYPE HTML>

<html>

<head>

<script id="allmobilize" charset="utf-8" src="${rc.contextPath}/js/allmobilize.min.js"></script>

<meta http-equiv="Cache-Control" content="no-siteapp" />

<link rel="alternate" media="handheld"  />

<!-- end 云适配 -->

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<title>注册-城建就业指导网</title>

<!-- <div class="web_root"  style="display:none">h</div> -->
<script type="text/javascript">var ctx = "h";
console.log(1);</script>
<link rel="Shortcut Icon" href="h/images/favicon.ico">
<link rel="stylesheet" type="text/css" href="${rc.contextPath}/css/style.css"/>

<script src="${rc.contextPath}/js/jquery.1.10.1.min.js" type="text/javascript"></script>
<script type="text/javascript" src="${rc.contextPath}/js/jquery.lib.min.js"></script>
<script type="text/javascript" src="${rc.contextPath}/js/core.min.js"></script>
<script type="text/javascript" src="${rc.contextPath}/js/conv.js"></script>
</head>



<body id="login_bg">

	<div class="login_wrapper">

		<div class="login_header">

        	<a href="index.html"><img src="${rc.contextPath}/img/login_white2.png" width="285" height="62" alt="拉勾招聘" /></a>

            <div id="cloud_s"><img src="${rc.contextPath}/img/cloud_s.png" width="81" height="52" alt="cloud" /></div>

            <div id="cloud_m"><img src="${rc.contextPath}/img/cloud_m.png" width="136" height="95"  alt="cloud" /></div>

        </div>

        

    	<input type="hidden" id="resubmitToken" value="9b207beb1e014a93bc852b7ba450db27" />		
		<div class="login_box">
        	<form id="loginForm">
        		<ul class="register_radio clearfix">
		            <li>
		            	学生注册
		              	<input type="radio" value="0" name="usertype" /> 
		            </li>
		            <li>
		           	           企业注册
		              	<input type="radio" value="1" name="usertype" /> 
		            </li>
		        </ul> 
            	<input type="text" id="email" name="email" tabindex="1" placeholder="请输入常用邮箱地址" />
                <span class="error" style="display:none;" id="beError"></span>
                <input type="text" name="code" id="code" placeholder="验证码" tabindex="2" style="width: 100px"/>
                <input type="button" id="sendCode" value="发送验证码" />
                <input type="password" id="password" name="password" tabindex="3" placeholder="请输入密码" />
            	<label class="fl registerJianJu" for="checkbox">
            		<input type="checkbox" id="checkbox" name="checkbox" checked  class="checkbox valid" />我已阅读并同意<a href="h/privacy.html" target="_blank">《城建就业指导网用户协议》</a>
           		</label>
                <input type="submit" id="submitLogin" value="注 &nbsp; &nbsp; 册" />
                
            </form>
            <div class="login_right">
            	<div>已有帐号</div>
            	<a  href="${rc.contextPath}/login"  class="registor_now">直接登录</a>
                <div class="login_others">使用以下帐号直接登录:</div>
                <!-- <a  href="h/ologin/auth/sina.html"  target="_blank" class="icon_wb" title="使用新浪微博帐号登录"></a>
               	<a  href="h/ologin/auth/qq.html"  class="icon_qq" target="_blank" title="使用腾讯QQ帐号登录" ></a> -->
            </div>
        </div>
        <div class="login_box_btm"></div>
    </div>
    
    <script type="text/javascript">
    $(document).ready(function(e) {
	$('.register_radio li input').click(function(e) {
		$(this).parent('li').addClass('current').append('<em></em>').siblings().removeClass('current').find('em').remove();
	});

	$('#email').focus(function() {
		$('#beError').hide();
	});
	//验证表单
	$("#loginForm").validate({
		rules: {
			usertype: {
				required: true
			},
			email: {
				required: true,
				email: true
			},
			code: {
				required: true
			},
			password: {
				required: true,
				rangelength: [6, 16]
			},
			checkbox: {
				required: true
			}
		},
		messages: {
			usertype: {
				required: "请选择注册用户类型"
			},
			email: {
				required: "请输入常用邮箱地址",
				email: "请输入有效的邮箱地址，如：vivi@163.com"
			},
			code: {
				required: "请输入验证码"
			},
			password: {
				required: "请输入密码",
				rangelength: "请输入6-16位密码，字母区分大小写"
			},
			checkbox: {
				required: "请接受注册用户协议"
			}
		},
		errorPlacement: function(label, element) {
			/* 
						    		if(element.attr("type") == "radio"){
						    			label.insertAfter($(element).parents('ul')).css('marginTop','-20px');
						    		}else if(element.attr("type") == "checkbox"){
						    			label.inserresult.contenttAfter($(element).parent()).css('clear','left');
						    		}else{
						    			label.insertAfter(element);
						    		} */
			/*modify nancy*/
			if(element.attr("type") == "radio") {
				label.insertAfter($(element).parents('ul')).css('marginTop', '-20px');
			} else if(element.attr("type") == "checkbox") {
				label.insertAfter($(element).parent()).css('clear', 'left');
			} else {
				label.insertAfter(element);
			};
		},
		submitHandler: function(form) {
			var type = $('input[type="radio"]:checked', form).val();
			var email = $('#email').val();
			var password = $('#password').val();
			var resubmitToken = $('#resubmitToken').val();

			var callback = $('#callback').val();
			var authType = $('#authType').val();
			var signature = $('#signature').val();
			var timestamp = $('#timestamp').val();

			$(form).find(":submit").attr("disabled", true);

			
						jQuery.post("${rc.contextPath}/register", $("#loginForm").serialize(), function(data) {
							if(data.code == 200){
								window.location.href = "${rc.contextPath}/";
							}
							$("#beError").css("display","block");
							$("#beError").text(data.info);
							
						}, 'json');
						
				
		}
	});
});
    
    
    /**
	 * 点击发送验证的事件
	 */
	$("#sendCode").click(
			function() {
				var txt = $("#email").val();
				jQuery.post("${rc.contextPath}/email/sendcode", {email:txt}, function(data) {
					if (data.code == 200) {
						settime($("#sendCode").get(0));
					}
					
					
				}, 'json');
				
			});
	/**
		设置时间
	 */
	var time = 60;
	function settime(obj) {
		if (time == 0) {
			obj.removeAttribute("disabled");
			obj.value = "发送验证码";
			time = 60;
			return;
		} else {
			obj.setAttribute("disabled", true);
			obj.value = time + "s后重试";
			time--;
		}
		setTimeout(function() {
			settime(obj)
		}, 1000)
	}
    
    
    </script>
</body>
</html>
